<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta charset="UTF-8" />
    <title>抢红包测试</title>
    <script src="/webjars/jquery/3.1.1/jquery.min.js"></script>
    <script src="/webjars/bootstrap/3.3.7-1/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/webjars/bootstrap/3.3.7-1/css/bootstrap.min.css" />
</head>
<body>

</body>
</html>
<script type="text/javascript">
    $(document).ready(function () {
        //模拟30000个异步请求，进行并发
        var max = 30000;
        for (var i = 1; i <= max; i++) {
            //jQuery的post请求，请注意这是异步请求
            $.post({
                //请求抢id为1的红包
                //根据自己请求修改对应的url和大红包编号
                url: "/userRedPacket/grapRedPacket?redPacketId=1&userId=" + i,
                //成功后的方法
                success: function (result) {
                }
            });
        }
    });
    // $.ajax({
    //     url: "/userRedPacket/grapRedPacket2",
    //     type: "post",
    //     success: function (data) {
    //
    //     }
    // })
</script>